package org.kamionowski.supreme.controllers.base;

import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: Marcin Kamionowski
 * Date: 04.04.11
 * Time: 23:54
 */
public abstract class AbstractJsonController extends BaseController {

    protected Map<String, Object> objects = new HashMap<String, Object>();

    protected ModelAndView createJson(){
        ModelAndView mav = new ModelAndView();
        mav.setViewName("json");
        for(Map.Entry<String, Object> entry : objects.entrySet()){
            mav.addObject(entry.getKey(), entry.getValue());
        }
        return mav;
    }
}
